//package com.hexing.forecast.LSTM;
//
//import org.deeplearning4j.nn.multilayer.MultiLayerNetwork;
//import org.deeplearning4j.nn.modelimport.keras.KerasModelImport;
//import org.deeplearning4j.nn.modelimport.keras.KerasSequential;
//import org.deeplearning4j.nn.modelimport.keras.layers.LSTM;
//import org.deeplearning4j.nn.modelimport.keras.layers.core.Flatten;
//import org.deeplearning4j.nn.modelimport.keras.models.SequentialModel;
//import org.deeplearning4j.nn.multilayer.MultiLayerNetwork;
//import org.deeplearning4j.util.ModelSerializer;
//import org.nd4j.linalg.api.ndarray.INDArray;
//import org.nd4j.linalg.dataset.api.preprocessor.Normalizer;
//import org.nd4j.linalg.dataset.api.preprocessor.StandardizationScaler;
//
//import java.io.File;
//import java.io.IOException;
//
//public class CreateSaveModel {
//    public static void main(String[] args) throws IOException {
//        // Create a Keras model from Sequential API
//        KerasSequential kerasModel = new KerasSequential();
//        kerasModel.add(new LSTM(64, returnSequences=true, inputShape=(long)10)); //64是因为我们的输入是64维的向量，你可以根据实际情况修改这个参数。
//        kerasModel.add(new Flatten()); //将LSTM的输出展平，因为LSTM的输出是二维的，我们需要将其展平为一维的才能输入到全连接层。
//        kerasModel.add(new Dense(1)); //1是因为我们只需要预测一个值，如果你需要预测多个值，那么你应该修改这个参数。
//        SequentialModel model = new SequentialModel(kerasModel); //将KerasSequential转化为DL4J的MultiLayerNetwork模型。
//        // Compile the model with desired configuration (in this case, we are using the default values provided by Keras)
//        model.compile();
//        // Use the model to do some training or evaluation (e.g., on some small set of data) here...
//        //...
//        // After training, serialize the model to a file:
//        ModelSerializer.writeModel(model, new File("path/to/your/model/file")); //保存模型到文件，文件可以是h5或者bin格式。
//    }
//}